#ifndef _RENZO_LOG_
#define _RENZO_LOG_

#include "RenzoMustHave.h"
/*
@description
Log provides a system-wide message log for tracking down bugs and run-time information.

Error management: 
Function does not return error code. Error code is pushed to an error stack for users to get if necessary.

*/

namespace Renzo {
class RENZODERER_API Log
{
private:
	Log(void);
	~Log(void);
	
public:
	// singleton 
	static Log* instance();
	//#define log_to_file(fmt, ...)		log_write(fmt, ## __VA_ARGS__)
	//#define log_to_file(fmt, args...) log_write(fmt, args)
	void open();
	void close();
	void write(const char* fmt, ...);
	void write(const char* fmt, va_list args);
	void tabWrite(const char* fmt, ...);	// indent by a tab and write
	void untabWrite(const char* fmt, ...);	// unident by a tab and write
private:
	static Log* log;
	FILE* _log_file;
	FILE* _err_file;
	FILE* _stdout_file;

private:
	// tab system
	int tab;
	void _write(const char* fmt, va_list args);
};
}

#endif
